<?php
namespace Models\Model;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Select;
use Zend\Paginator\Adapter\DbSelect;
use Zend\Paginator\Paginator;
use Zend\Db\Sql\Predicate;
use Zend\Db\Sql\Expression;
class InsurancesTable
{
    protected $tableGateway;
	protected $select;
    public function __construct(TableGateway $tableGateway)
    {
        $this->tableGateway = $tableGateway;
		$this->select = new Select();
    }
	public function getAllInsurances()
    {
	    $select = $this->tableGateway->getSql()->select();
		$resultSet = $this->tableGateway->selectWith($select);
		return $resultSet;
	}
	public function getUserdata($Userdata)
    {
	    $select = $this->tableGateway->getSql()->select();
		$select->join('insurances', new Expression('insurances.insurance_id=request_services.insurance_id'),array('insurance_name'),'left');		
		$select->where('request_services.user_id="'.$user_id.'"');
		$select->order('request_services.request_services_id DESC');
		$resultSet = $this->tableGateway->selectWith($select);	
		return $resultSet;
	}
}